<?php defined('IN_YuLin') || exit('NO PERMIT!'); ?>
{template index/header}
<style>
    .read-note{
	   font-weight:normal;
    }
</style>
	<div class="container containerUser fix pt15">
		{template member/slide}
	<div class="userRight">
		<div class="userTitle mgb10">站内信</div>
		<div class="userMain mgb10">
			<div class="sendList">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tbody>
						<tr>
							<th scope="col">&nbsp;</th>
							<th scope="col">主题</th>
							<th scope="col">发件人</th>
							<th scope="col">时间</th>
						</tr>
					</tbody>
					<tbody class="fudetail_list">
					{if $data}
						{loop $data as $key=>$val}
						<tr class="noData" style="border-bottom: 0px;">
							<td><input type="checkbox" name="ids[$key]" class="del" value="{$val['id']}"></td>
							<td><a href="?m=member&c=letter_info&id={$val['id']}" id="a_type_{$val['id']}" {if $val['is_read']=="1"} style="font-weight:normal;" {/if}>
								{if $val['mail_type']=="1"}系统消息{/if}
								</a>
							</td>
							<td>{$val['sender_name']}</td>
							<td>{date('Y-m-d',$val['dateline'])}</td>
						</tr>
						{/loop}
					{else}
						<tr class="noData" style="border-bottom: 0px;">
							<td colspan="4">
    							<div class="notContent" style="padding: 100px 0px;">
    								<i class="iconfont"></i>暂无记录
    							</div>
							</td>
						</tr>	
					{/if}
					</tbody>
				</table>
				<div class="page">
					<p>
						共<em>{$tmp['p']}</em>条记录
					</p>
					{if $data}
    					<div id="pageNav" class="pageNav">
    						<div id="pageNav" class="pageNav">
    							{if $tmp['p']>0}
    								{$multi}
    							{/if}
    						</div>
    					</div>
    				{/if}
				</div>
				<div class="msgControl">
					{if $tmp['p']>0}
						<input type="checkbox" id="all_select" name="all_select" onclick="choose_all();">全选 
						<input type="button" value="标为已读" onclick="change_read();"> 
						<input type="button" value="删除" onclick="del();">
					{/if}
				</div>
				<div class="userTip">
					<p>
						<i></i>温馨提示：系统将自动清空5天前的用户消息记录。
					</p>
				</div>
			</div>
		</div>
	</div>
</div>
	<script type="text/javascript">
        function choose_all(){
    		$(".del").each(function(n,j){
    			if(!$(this).is(":checked")){
    				$(this).prop("checked",true);
    				$("#all_select").prop("checked",true);
    			}else{
    				$(this).removeAttr("checked",false);
    				$("#all_select").removeAttr("checked",false);
    			}
    		})
        }
    	   
    	function del(){
    		var arr = [];
    		$(".del").each(function(n,j){
				if($(this).is(":checked")){
					arr.push($(this).val());
				}
			});
    		$.post('?m=member&c=letter&a=del',{
				'del_ids': arr
			},function (json){
				if(json.status=="1"){
					alert("删除成功！");
					location.href=location.href;
				}else{
					alert("失败");
				}
			},'json');	
        }

		function choose_read(){
			$("#myform").submit();
		}

        function change_read(){
        	var arr1 = [];
    		$(".del").each(function(n,j){
				if($(this).is(":checked")){
					arr1.push($(this).val());
				}
			});
    		$.post('?m=member&c=letter&a=read',{
				'read_ids': arr1
			},function (json){
				if(json.status=="1"){
					location.href=location.href;
				}else{
					alert("标注失败！");
				}
			},'json');	
        }	
    </script>



{template index/footer}